package com.witmed.lib_common.room

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import kotlinx.coroutines.flow.Flow
import org.jetbrains.annotations.NotNull

@Dao
interface VideoDao {
    //新增数据
    @Insert(onConflict = OnConflictStrategy.REPLACE)
    suspend fun insert(video:VideoHistory)

    //根据id查询视频资源
    @Query("select * from video where id=:id")
     fun getById(id:Int):Flow<VideoHistory>

    //根据最新时间查询前10条
    @Query("select * from video order by vtime desc limit 0,9")
     fun getList():Flow<List<VideoHistory>>

    //查询所有
    @Query("select * from video order by vtime desc")
     fun getAll():Flow<List<VideoHistory>>
}